

from haystack import Document
from haystack.document_stores.in_memory import InMemoryDocumentStore
from haystack.components.writers import DocumentWriter

documents = [
    Document(content="This is document 1"),
    Document(content="This is document 2")
]

document_store = InMemoryDocumentStore()
document_writer = DocumentWriter(document_store = document_store)
document_writer.run(documents=documents)


'''
from haystack import Document
from haystack.components.rankers import TransformersSimilarityRanker

docs = [Document(content="Paris"), Document(content="Berlin")]

ranker = TransformersSimilarityRanker()
ranker.warm_up()

output=ranker.run(query="City in France", documents=docs, top_k=1)
print(output)


from haystack_integrations.document_stores.chroma import ChromaDocumentStore
from haystack import Document

document_store = ChromaDocumentStore(persist_path='./chroma.db')

document_store.write_documents([
    Document(content="This is the first document."),
    Document(content="This is the second document.")
])
output=document_store.search('second',top_k=1)
print(output)
print(document_store.count_documents())
'''